import 'package:dk_flutter_base/dk_core.dart';

import './bean_tools_item.dart';

class ToolsCategoryBean {
  String categoryName;  //业务线名称
  String categoryId;  //业务线id
  List<ModulesListBean> modules; //业务线工具

  ToolsCategoryBean({this.categoryName, this.categoryId, this.modules});

  ToolsCategoryBean.fromJson(Map<String, dynamic> json) {    
    this.categoryName = json['categoryName'];
    this.categoryId = json['categoryId'];
    dynamic data = json['modules'];
    this.modules = (data is List) ? data.map((i) => ModulesListBean.fromJson(i)).toList():null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['categoryName'] = this.categoryName;
    data['categoryId'] = this.categoryId;
    data['modules'] = this.modules != null?this.modules.map((i) => i.toJson()).toList():null;
    return data;
  }

}

class ModulesListBean {
  String moduleName;   //二级模块标题
  List<ToolsItem> tools; //工具列表

  ModulesListBean({this.moduleName, this.tools});

  ModulesListBean.fromJson(Map<String, dynamic> json) {    
    this.moduleName = json['moduleName'];
    this.tools = (json['tools'] as List)!=null?(json['tools'] as List).map((i) => ToolsItem.fromJson(i)).toList():null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['moduleName'] = this.moduleName;
    data['tools'] = this.tools != null?this.tools.map((i) => i.toJson()).toList():null;
    return data;
  }
}

